CREATE TABLE [dbo].[tb_RegistroDeLiquidaciones]
(
[idRegistroLiquidacion] [int] NOT NULL IDENTITY(1, 1),
[Liquidacion] [int] NOT NULL,
[Agente] [int] NOT NULL,
[Organizacion] [int] NULL,
[Servicio] [int] NULL,
[LegajoSalarial] [int] NOT NULL,
[CargoSalarial] [int] NULL,
[SituacionRevista] [int] NULL,
[Horas] [int] NULL,
[Desde] [datetime] NULL,
[Hasta] [datetime] NULL,
[Dias] [datetime] NULL,
[Concepto] [int] NOT NULL,
[Cantidad] [int] NULL,
[Afiliacion] [int] NULL,
[Descripcion] [varchar] (2) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[MontoHaberes] [decimal] (18, 4) NOT NULL,
[MontoDescuento] [decimal] (18, 4) NOT NULL,
[DescuentoExterno] [int] NULL,
[Embargo] [int] NULL,
[Ajuste] [int] NULL,
[AfectadosPorAjuste] [int] NULL,
[Reclamado] [int] NULL,
[DiasLiquidados] [int] NULL,
[SubOrganizacion] [int] NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[tb_RegistroDeLiquidaciones] ADD CONSTRAINT [PK_tb_RegistroDeLiquidaciones] PRIMARY KEY CLUSTERED  ([idRegistroLiquidacion]) WITH (FILLFACTOR=95) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [idx_Agente] ON [dbo].[tb_RegistroDeLiquidaciones] ([Agente]) WITH (FILLFACTOR=95) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [idx_Liquidacion] ON [dbo].[tb_RegistroDeLiquidaciones] ([Liquidacion]) WITH (FILLFACTOR=95) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [idx_Servicio] ON [dbo].[tb_RegistroDeLiquidaciones] ([Servicio]) WITH (FILLFACTOR=95) ON [PRIMARY]
GO
ALTER TABLE [dbo].[tb_RegistroDeLiquidaciones] WITH NOCHECK ADD CONSTRAINT [FK_tb_RegistroDeLiquidaciones_tb_Ajustes1] FOREIGN KEY ([AfectadosPorAjuste]) REFERENCES [dbo].[tb_Ajustes] ([idAjuste])
GO
ALTER TABLE [dbo].[tb_RegistroDeLiquidaciones] WITH NOCHECK ADD CONSTRAINT [FK_tb_RegistroDeLiquidaciones_tb_Afiliaciones] FOREIGN KEY ([Afiliacion]) REFERENCES [dbo].[tb_Afiliaciones] ([idAfiliacion])
GO
ALTER TABLE [dbo].[tb_RegistroDeLiquidaciones] WITH NOCHECK ADD CONSTRAINT [FK_tb_RegistroDeLiquidaciones_tb_Agentes] FOREIGN KEY ([Agente]) REFERENCES [dbo].[tb_Agentes] ([idAgente])
GO
ALTER TABLE [dbo].[tb_RegistroDeLiquidaciones] WITH NOCHECK ADD CONSTRAINT [FK_tb_RegistroDeLiquidaciones_tb_Ajustes] FOREIGN KEY ([Ajuste]) REFERENCES [dbo].[tb_Ajustes] ([idAjuste])
GO
ALTER TABLE [dbo].[tb_RegistroDeLiquidaciones] WITH NOCHECK ADD CONSTRAINT [FK_tb_RegistroDeLiquidaciones_tb_ConceptosDeLiquidacion] FOREIGN KEY ([Concepto]) REFERENCES [dbo].[tb_ConceptosDeLiquidacion] ([idConceptoLiquidacion])
GO
ALTER TABLE [dbo].[tb_RegistroDeLiquidaciones] WITH NOCHECK ADD CONSTRAINT [FK_tb_RegistroDeLiquidaciones_tb_DescuentosExternos] FOREIGN KEY ([DescuentoExterno]) REFERENCES [dbo].[tb_DescuentosExternos] ([idDescuento])
GO
ALTER TABLE [dbo].[tb_RegistroDeLiquidaciones] WITH NOCHECK ADD CONSTRAINT [FK_tb_RegistroDeLiquidaciones_tb_Embargos] FOREIGN KEY ([Embargo]) REFERENCES [dbo].[tb_Embargos] ([idEmbargo])
GO
ALTER TABLE [dbo].[tb_RegistroDeLiquidaciones] WITH NOCHECK ADD CONSTRAINT [FK_tb_RegistroDeLiquidaciones_tb_Liquidaciones] FOREIGN KEY ([Liquidacion]) REFERENCES [dbo].[tb_Liquidaciones] ([idLiquidacion])
GO
ALTER TABLE [dbo].[tb_RegistroDeLiquidaciones] WITH NOCHECK ADD CONSTRAINT [FK_tb_RegistroDeLiquidaciones_tb_Organizaciones] FOREIGN KEY ([Organizacion]) REFERENCES [dbo].[tb_Organizaciones] ([idOrganizaciones])
GO
ALTER TABLE [dbo].[tb_RegistroDeLiquidaciones] WITH NOCHECK ADD CONSTRAINT [FK_tb_RegistroDeLiquidaciones_tb_Reclamos] FOREIGN KEY ([Reclamado]) REFERENCES [dbo].[tb_Reclamos] ([idReclamo])
GO
